import React, { PureComponent } from 'react';
import { Icon,Form, notification } from 'antd';
import { connect } from 'dva';
import "./form.less"
import "../../Common.less"
import { requestFullScreen, exitFull } from "../../utils/fullScreen"
class PositionModal extends PureComponent {
    constructor(props) {
        super(props);
        this.state = {
            roadlist: []
        }
        this.onConfirm=this.onConfirm.bind(this)
    }
    onConfirm(params = {}) {
        if (params.onSuccess) {
            params.onSuccess();
        }
    }
    componentDidMount() {
        if (this.props.onLoaded) {
            this.props.onLoaded(this)
        }
        const { tdata } = this.props.extra;
        this.setState({
            tdata
        })
    }
    render() {
        const { tdata ,exit} = this.state;
        return (
            <div id="positionModal" style={{ height: "60vh", overflow: "auto" }} className="positionModal tableBoxS tcBox">
                 {
                    !exit? <Icon onClick={e => {
                        this.setState({
                            exit:true
                        })
                        requestFullScreen(document.querySelector(".ant-modal"))
                        document.querySelector(".positionModal").style.height="calc(100vh - 85px)"
                        document.querySelector(".ant-modal-body").style.height="calc(100vh - 70px)"
                    }} className="fullScreen" type="fullscreen" />: <Icon onClick={e =>{
                        this.setState({
                            exit:false
                        })
                        exitFull()
                        document.querySelector(".positionModal").style.height="calc(70vh - 85px)"
                        document.querySelector(".ant-modal-body").style.height="calc(70vh - 70px)"
                    }} className="fullScreen" type="fullscreen-exit" />
                }
               
                <table style={{ width: "calc(100% - 30px)", margin: "auto"}}>
                        <tbody>
                            <tr className="th">
                                <td>序号</td>
                                <td>桩号(m)</td>
                                {/* <td>右偏角</td>
                                <td>桩位编号</td>
                                <td>偏心距</td>
                                <td>桩间距</td> */}
                                <td>X坐标(m)</td>
                                <td>Y坐标(m)</td>
                                <td>方位角(度)</td>
                            </tr>
                            {
                                tdata && tdata.length&&tdata[0].x ? tdata.map((item,index) => {
                                    return <tr key={'tr'+index}>
                                        <td>{index+1}</td>
                                        <td>{item.station}</td>
                                        {/* <td><input data-key="angle" defaultValue="90" className="input" type="text" /></td>
                                        <td><input data-key="no" defaultValue="1" className="input" type="text" /></td>
                                        <td><input data-key="eccentricity" defaultValue="4.25" className="input" type="text" /></td>
                                        <td><input data-key="pileSpacing" defaultValue="0" className="input" type="text" /></td> */}
                                        <td>{item.x}</td>
                                        <td>{item.y}</td>
                                        <td>{item.azimuth}</td>
                                    </tr>
                                }) : <tr><td colSpan="5">no data</td></tr>
                            }

                        </tbody>
                    </table>
            </div>
        );
    }
}

export default connect(
    ({
        project: { current }
    }) => {
        return { project: current };
    },
    dispatch => ({
        loadProjectRoads: (values) => dispatch({
            type: 'refRoads/loadProjectRoads',
            payload: values
        }),

    })
)(Form.create('PositionModal', {

})(PositionModal));